package makaveli.listview;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class MyArrayAdapter extends ArrayAdapter<People>{
	private People[] _peopleArr;
	
	public MyArrayAdapter(Context context, int resource,
			int textViewResourceId, People[] objects) {
		super(context, resource, textViewResourceId, objects);
		_peopleArr = objects;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View v = super.getView(position, convertView, parent);
		
		((TextView) v.findViewById(R.id.peopleName)).setText(_peopleArr[position]._name);
		((TextView) v.findViewById(R.id.peopleAge)).setText(String.valueOf(_peopleArr[position]._age));
		
		((TextView) v.findViewById(R.id.peopleSurname)).setText(_peopleArr[position]._surName);
		((TextView) v.findViewById(R.id.peopleSalary)).setText(String.valueOf(_peopleArr[position]._salary));
		
		return v;
	}

}